package me.leiusual.sharing.repository

import io.reactivex.Single
import me.leiusual.sharing.api.ApiOauth2
import me.leiusual.sharing.api.ApiSharing
import me.leiusual.sharing.api.model.AdStart
import javax.inject.Inject
import javax.inject.Singleton

/**
 * Create by leiusual on 2018/7/24
 */
@Singleton
class AdRepository @Inject constructor(
    private val apiSharing: ApiSharing
) {

  fun adStart(): Single<String> {
    return apiSharing.adStart(AdStart.Request(ApiOauth2.CLIENT_ID, "START_AD", null))
        .map {
          it.first().imageUrl
        }
  }
}